<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>AIfES 2: aimath_q7_default.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="AIfES_logo_small.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">AIfES 2
   &#160;<span id="projectnumber">2.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('aimath__q7__default_8h.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">aimath_q7_default.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Math functions for <a class="el" href="aimath__q7_8h.html">Q7 </a> data type, default implementation.  
<a href="#details">More...</a></p>

<p><a href="aimath__q7__default_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ae14116c35f7bcafa336131627e208acd"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q7__default_8h.html#ae14116c35f7bcafa336131627e208acd">aimath_q7_default_linear32</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *a, const <a class="el" href="structaitensor.html">aitensor_t</a> *b, const <a class="el" href="structaitensor.html">aitensor_t</a> *c, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:ae14116c35f7bcafa336131627e208acd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs a matrix multiplication of <a class="el" href="aimath__q7_8h.html">Q7 </a> matrices a and b and adds a <a class="el" href="aimath__q31_8h.html">Q31 </a> vector c to each row.  <a href="aimath__q7__default_8h.html#ae14116c35f7bcafa336131627e208acd">More...</a><br /></td></tr>
<tr class="separator:ae14116c35f7bcafa336131627e208acd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8457eb57e8075ad70123092df8b57233"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q7__default_8h.html#a8457eb57e8075ad70123092df8b57233">aimath_q7_default_linear32_bt</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *a, const <a class="el" href="structaitensor.html">aitensor_t</a> *b, const <a class="el" href="structaitensor.html">aitensor_t</a> *c, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:a8457eb57e8075ad70123092df8b57233"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs a matrix multiplication of <a class="el" href="aimath__q7_8h.html">Q7 </a> matrices a and b (transposed) and adds a <a class="el" href="aimath__q31_8h.html">Q31 </a> vector c to each row.  <a href="aimath__q7__default_8h.html#a8457eb57e8075ad70123092df8b57233">More...</a><br /></td></tr>
<tr class="separator:a8457eb57e8075ad70123092df8b57233"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abb9d7e4822da469bd0196c6c8c24039c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q7__default_8h.html#abb9d7e4822da469bd0196c6c8c24039c">aimath_q7_default_mat_mul</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *a, const <a class="el" href="structaitensor.html">aitensor_t</a> *b, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:abb9d7e4822da469bd0196c6c8c24039c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs a matrix multiplication of <a class="el" href="aimath__q7_8h.html">Q7 </a> matrices a and b.  <a href="aimath__q7__default_8h.html#abb9d7e4822da469bd0196c6c8c24039c">More...</a><br /></td></tr>
<tr class="separator:abb9d7e4822da469bd0196c6c8c24039c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aea8ff135f469f27eda0478fc21e4a568"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q7__default_8h.html#aea8ff135f469f27eda0478fc21e4a568">aimath_q7_default_multiply</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *a, const <a class="el" href="structaitensor.html">aitensor_t</a> *b, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:aea8ff135f469f27eda0478fc21e4a568"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs an element wise multiplication of <a class="el" href="aimath__q7_8h.html">Q7 </a> tensors a and b (Hadamard product)  <a href="aimath__q7__default_8h.html#aea8ff135f469f27eda0478fc21e4a568">More...</a><br /></td></tr>
<tr class="separator:aea8ff135f469f27eda0478fc21e4a568"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab09f6f205301031766d1211f1f22b77d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q7__default_8h.html#ab09f6f205301031766d1211f1f22b77d">aimath_q7_default_scalar_mul</a> (const void *scalar, const <a class="el" href="structaitensor.html">aitensor_t</a> *a, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:ab09f6f205301031766d1211f1f22b77d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs a scalar multiplication (scaling) of <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor a and a scalar.  <a href="aimath__q7__default_8h.html#ab09f6f205301031766d1211f1f22b77d">More...</a><br /></td></tr>
<tr class="separator:ab09f6f205301031766d1211f1f22b77d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5495242497ca55e067957e5cfb8ecd47"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q7__default_8h.html#a5495242497ca55e067957e5cfb8ecd47">aimath_q7_default_tensor_add_different_shift</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *a, const <a class="el" href="structaitensor.html">aitensor_t</a> *b, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:a5495242497ca55e067957e5cfb8ecd47"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs an element wise addition of <a class="el" href="aimath__q7_8h.html">Q7 </a> tensors a and b with different shifts.  <a href="aimath__q7__default_8h.html#a5495242497ca55e067957e5cfb8ecd47">More...</a><br /></td></tr>
<tr class="separator:a5495242497ca55e067957e5cfb8ecd47"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3030c62db3aba6f211019155866ac188"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q7__default_8h.html#a3030c62db3aba6f211019155866ac188">aimath_q7_default_tensor_add_same_shift</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *a, const <a class="el" href="structaitensor.html">aitensor_t</a> *b, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:a3030c62db3aba6f211019155866ac188"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs an element wise addition of <a class="el" href="aimath__q7_8h.html">Q7 </a> tensors a and b with same shifts.  <a href="aimath__q7__default_8h.html#a3030c62db3aba6f211019155866ac188">More...</a><br /></td></tr>
<tr class="separator:a3030c62db3aba6f211019155866ac188"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a95cefff68f55a80365250be42c54079c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q7__default_8h.html#a95cefff68f55a80365250be42c54079c">aimath_q7_default_tensor_sub_different_shift</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *a, const <a class="el" href="structaitensor.html">aitensor_t</a> *b, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:a95cefff68f55a80365250be42c54079c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs an element wise addition of <a class="el" href="aimath__q7_8h.html">Q7 </a> tensors a and b with different shifts.  <a href="aimath__q7__default_8h.html#a95cefff68f55a80365250be42c54079c">More...</a><br /></td></tr>
<tr class="separator:a95cefff68f55a80365250be42c54079c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab7cd6d81cc93235513fc28b27dc2fbd8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q7__default_8h.html#ab7cd6d81cc93235513fc28b27dc2fbd8">aimath_q7_default_tensor_sub_same_shift</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *a, const <a class="el" href="structaitensor.html">aitensor_t</a> *b, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:ab7cd6d81cc93235513fc28b27dc2fbd8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs an element wise subtraction of <a class="el" href="aimath__q7_8h.html">Q7 </a> tensors a and b with same shifts.  <a href="aimath__q7__default_8h.html#ab7cd6d81cc93235513fc28b27dc2fbd8">More...</a><br /></td></tr>
<tr class="separator:ab7cd6d81cc93235513fc28b27dc2fbd8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1d233a41fb19c9d444051cceea04c6d1"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q7__default_8h.html#a1d233a41fb19c9d444051cceea04c6d1">aimath_q7_default_copy_tensor</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *from, <a class="el" href="structaitensor.html">aitensor_t</a> *to)</td></tr>
<tr class="memdesc:a1d233a41fb19c9d444051cceea04c6d1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs an element wise copy of <a class="el" href="aimath__q7_8h.html">Q7 </a> tensors.  <a href="aimath__q7__default_8h.html#a1d233a41fb19c9d444051cceea04c6d1">More...</a><br /></td></tr>
<tr class="separator:a1d233a41fb19c9d444051cceea04c6d1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae989b3b4870f77f485ac8c1fc1657703"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q7__default_8h.html#ae989b3b4870f77f485ac8c1fc1657703">aimath_q7_default_transpose_vector</a> (<a class="el" href="structaitensor.html">aitensor_t</a> *vector)</td></tr>
<tr class="memdesc:ae989b3b4870f77f485ac8c1fc1657703"><td class="mdescLeft">&#160;</td><td class="mdescRight">Transposes a <a class="el" href="aimath__q7_8h.html">Q7 </a> vector.  <a href="aimath__q7__default_8h.html#ae989b3b4870f77f485ac8c1fc1657703">More...</a><br /></td></tr>
<tr class="separator:ae989b3b4870f77f485ac8c1fc1657703"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1f38ebd2e786763092b3d9fa97088388"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q7__default_8h.html#a1f38ebd2e786763092b3d9fa97088388">aimath_q7_default_transpose_matrix</a> (<a class="el" href="structaitensor.html">aitensor_t</a> *x)</td></tr>
<tr class="memdesc:a1f38ebd2e786763092b3d9fa97088388"><td class="mdescLeft">&#160;</td><td class="mdescRight">Transpose a <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor.  <a href="aimath__q7__default_8h.html#a1f38ebd2e786763092b3d9fa97088388">More...</a><br /></td></tr>
<tr class="separator:a1f38ebd2e786763092b3d9fa97088388"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a276405dee87319f05cff812b225ec5ed"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q7__default_8h.html#a276405dee87319f05cff812b225ec5ed">aimath_q7_default_sigmoid</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:a276405dee87319f05cff812b225ec5ed"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the sigmoid of each element in a <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor.  <a href="aimath__q7__default_8h.html#a276405dee87319f05cff812b225ec5ed">More...</a><br /></td></tr>
<tr class="separator:a276405dee87319f05cff812b225ec5ed"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6baa6499f2ecf3ae40e9f08ba39499cf"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q7__default_8h.html#a6baa6499f2ecf3ae40e9f08ba39499cf">aimath_q7_default_relu</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:a6baa6499f2ecf3ae40e9f08ba39499cf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the rectifier (ReLU) value of each element in a <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor.  <a href="aimath__q7__default_8h.html#a6baa6499f2ecf3ae40e9f08ba39499cf">More...</a><br /></td></tr>
<tr class="separator:a6baa6499f2ecf3ae40e9f08ba39499cf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3c64e64b1e09cd3b665d5436ee1a81f4"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q7__default_8h.html#a3c64e64b1e09cd3b665d5436ee1a81f4">aimath_q7_default_d_relu</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:a3c64e64b1e09cd3b665d5436ee1a81f4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the rectifier (ReLU) derivative of each element in a <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor.  <a href="aimath__q7__default_8h.html#a3c64e64b1e09cd3b665d5436ee1a81f4">More...</a><br /></td></tr>
<tr class="separator:a3c64e64b1e09cd3b665d5436ee1a81f4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abc7fe8c9d9ed1b56683871aad5b79e6b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q7__default_8h.html#abc7fe8c9d9ed1b56683871aad5b79e6b">aimath_q7_default_leaky_relu</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, const void *alpha, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:abc7fe8c9d9ed1b56683871aad5b79e6b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the leaky rectifier (leaky ReLU) value of each element in a <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor.  <a href="aimath__q7__default_8h.html#abc7fe8c9d9ed1b56683871aad5b79e6b">More...</a><br /></td></tr>
<tr class="separator:abc7fe8c9d9ed1b56683871aad5b79e6b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9904ddb34fdb99f5e448fa6a72a1aedf"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q7__default_8h.html#a9904ddb34fdb99f5e448fa6a72a1aedf">aimath_q7_default_elu</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, const void *alpha, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:a9904ddb34fdb99f5e448fa6a72a1aedf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the exponential rectifier (ELU) value of each element in a <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor.  <a href="aimath__q7__default_8h.html#a9904ddb34fdb99f5e448fa6a72a1aedf">More...</a><br /></td></tr>
<tr class="separator:a9904ddb34fdb99f5e448fa6a72a1aedf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad54410eb70a8dc52402cce9df193efc8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q7__default_8h.html#ad54410eb70a8dc52402cce9df193efc8">aimath_q7_default_tanh</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:ad54410eb70a8dc52402cce9df193efc8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the tanh of each element in a <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor.  <a href="aimath__q7__default_8h.html#ad54410eb70a8dc52402cce9df193efc8">More...</a><br /></td></tr>
<tr class="separator:ad54410eb70a8dc52402cce9df193efc8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ade55b697f7366df6aa1350cca23411f8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q7__default_8h.html#ade55b697f7366df6aa1350cca23411f8">aimath_q7_default_softsign</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:ade55b697f7366df6aa1350cca23411f8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the softsign value of each element in a <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor.  <a href="aimath__q7__default_8h.html#ade55b697f7366df6aa1350cca23411f8">More...</a><br /></td></tr>
<tr class="separator:ade55b697f7366df6aa1350cca23411f8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9a397ffb85d001e9d99c904369e8c7f4"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q7__default_8h.html#a9a397ffb85d001e9d99c904369e8c7f4">aimath_q7_default_softmax</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:a9a397ffb85d001e9d99c904369e8c7f4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the softmax value of each batch element (row) of a <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor.  <a href="aimath__q7__default_8h.html#a9a397ffb85d001e9d99c904369e8c7f4">More...</a><br /></td></tr>
<tr class="separator:a9a397ffb85d001e9d99c904369e8c7f4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2264128c09cf1d1e7c0a6699fe75b2c8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q7__default_8h.html#a2264128c09cf1d1e7c0a6699fe75b2c8">aimath_q7_default_zero_tensor</a> (<a class="el" href="structaitensor.html">aitensor_t</a> *tensor)</td></tr>
<tr class="memdesc:a2264128c09cf1d1e7c0a6699fe75b2c8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Fills a <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor with zeros.  <a href="aimath__q7__default_8h.html#a2264128c09cf1d1e7c0a6699fe75b2c8">More...</a><br /></td></tr>
<tr class="separator:a2264128c09cf1d1e7c0a6699fe75b2c8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6bf3ea9845ce25041a98628df953f23c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q7__default_8h.html#a6bf3ea9845ce25041a98628df953f23c">aimath_q7_default_init_zeros</a> (<a class="el" href="structaitensor.html">aitensor_t</a> *tensor)</td></tr>
<tr class="memdesc:a6bf3ea9845ce25041a98628df953f23c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Fills a <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor with zeros.  <a href="aimath__q7__default_8h.html#a6bf3ea9845ce25041a98628df953f23c">More...</a><br /></td></tr>
<tr class="separator:a6bf3ea9845ce25041a98628df953f23c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Math functions for <a class="el" href="aimath__q7_8h.html">Q7 </a> data type, default implementation. </p>
<dl class="section version"><dt>Version</dt><dd>2.2.0 </dd></dl>
<dl class="section copyright"><dt>Copyright</dt><dd>Copyright (C) 2020-2023 Fraunhofer Institute for Microelectronic Circuits and Systems. All rights reserved.<br  />
<br  />
 AIfES is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.<br  />
<br  />
 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.<br  />
<br  />
 You should have received a copy of the GNU Affero General Public License along with this program. If not, see <a href="https://www.gnu.org/licenses/">https://www.gnu.org/licenses/</a>.</dd></dl>
<p>These functions can be used when no hardware specific implementation is available. </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a1d233a41fb19c9d444051cceea04c6d1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1d233a41fb19c9d444051cceea04c6d1">&#9670;&nbsp;</a></span>aimath_q7_default_copy_tensor()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q7_default_copy_tensor </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>from</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>to</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs an element wise copy of <a class="el" href="aimath__q7_8h.html">Q7 </a> tensors. </p>
<p class="formulaDsp">
\[ to \leftarrow from \]
</p>
<p>Dimension, shape and quantization parameters of from and to tensors have to be the same.</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t from_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> from_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t from_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                          -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> from = AITENSOR_2D_Q7(from_shape, &amp;from_params, from_data);</div>
<div class="line"> </div>
<div class="line">uint16_t to_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> to_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t to_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> to = AITENSOR_2D_Q7(to_shape, &amp;to_params, to_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q7__default_8h.html#a1d233a41fb19c9d444051cceea04c6d1">aimath_q7_default_copy_tensor</a>(&amp;from, &amp;to);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;to);</div>
<div class="ttc" id="aaimath__basic_8h_html_ab10c8d06990943806f0be8fcc6af03fc"><div class="ttname"><a href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a></div><div class="ttdeci">void print_aitensor(const aitensor_t *tensor)</div><div class="ttdoc">Printing a tensor to console.</div></div>
<div class="ttc" id="aaimath__q7__default_8h_html_a1d233a41fb19c9d444051cceea04c6d1"><div class="ttname"><a href="aimath__q7__default_8h.html#a1d233a41fb19c9d444051cceea04c6d1">aimath_q7_default_copy_tensor</a></div><div class="ttdeci">void aimath_q7_default_copy_tensor(const aitensor_t *from, aitensor_t *to)</div><div class="ttdoc">Performs an element wise copy of Q7  tensors.</div></div>
<div class="ttc" id="astructaimath__q7__params_html"><div class="ttname"><a href="structaimath__q7__params.html">aimath_q7_params</a></div><div class="ttdoc">Parameters used for the quantized Q7  values, used as property of a tensor.</div><div class="ttdef"><b>Definition:</b> aimath_q7.h:148</div></div>
<div class="ttc" id="astructaitensor_html"><div class="ttname"><a href="structaitensor.html">aitensor</a></div><div class="ttdoc">A tensor in AIfES.</div><div class="ttdef"><b>Definition:</b> aifes_math.h:89</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*from</td><td>Q7 tensor to copy from (N-D tensor) </td></tr>
    <tr><td class="paramname">*to</td><td>Q7 tensor to copy to (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a3c64e64b1e09cd3b665d5436ee1a81f4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3c64e64b1e09cd3b665d5436ee1a81f4">&#9670;&nbsp;</a></span>aimath_q7_default_d_relu()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q7_default_d_relu </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the rectifier (ReLU) derivative of each element in a <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor. </p>
<p class="formulaDsp">
\[ result_{ij} = \begin{cases} 0 &amp; \text{if } x_i &lt; 0\\ 1 &amp; \text{if } x_i \geq 0 \end{cases} \]
</p>
<p><b>The quantization parameters of the result tensor are set to {shift = 0, zero_point = 0} by the function because the output values are either 0 or 1.</b></p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> x_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                       -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q7(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> result_params; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q7(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q7__default_8h.html#a3c64e64b1e09cd3b665d5436ee1a81f4">aimath_q7_default_d_relu</a>(&amp;x, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q7__default_8h_html_a3c64e64b1e09cd3b665d5436ee1a81f4"><div class="ttname"><a href="aimath__q7__default_8h.html#a3c64e64b1e09cd3b665d5436ee1a81f4">aimath_q7_default_d_relu</a></div><div class="ttdeci">void aimath_q7_default_d_relu(const aitensor_t *x, aitensor_t *result)</div><div class="ttdoc">Calculates the rectifier (ReLU) derivative of each element in a Q7  tensor.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*x</td><td>Q7 tensor to calculate the ReLU derivative from (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q7 tensor (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a9904ddb34fdb99f5e448fa6a72a1aedf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9904ddb34fdb99f5e448fa6a72a1aedf">&#9670;&nbsp;</a></span>aimath_q7_default_elu()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q7_default_elu </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>alpha</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the exponential rectifier (ELU) value of each element in a <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor. </p>
<p class="formulaDsp">
\[ result_{i} = \begin{cases} \alpha \cdot (e^{x_i} - 1) &amp; \text{if } x_i &lt; 0 \\ x_i &amp; \text{if } x_i \geq 0 \end{cases} \]
</p>
<p>The ELU is calculated with a piecewise linear approximation to avoid using exponential functions.</p>
<p class="formulaDsp">
\[ result_{i} = \begin{cases} x_i &amp; \text{if } 0 \leq x_i\\ \alpha \cdot 0.625 \cdot x_i &amp; \text{if } -1 \leq x &lt; 0\\ \alpha \cdot (0.25 \cdot x_i - 0.375) &amp; \text{if } -2 \leq x &lt; -1\\ \alpha \cdot (0.09375 \cdot x_i - 0.6875) &amp; \text{if } -3 \leq x &lt; -2\\ \alpha \cdot (0.03125 \cdot x_i - 0.875) &amp; \text{if } -4 \leq x &lt; -3\\ - \alpha &amp; \text{if } x &lt; -4 \end{cases} \]
</p>
<p><b>The quantization parameters of the result tensor are set to {shift = x.shift, zero_point = x.zero_point} by the function because the output values are in the interval (max(-alpha, min(x)), max(x)].</b></p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> x_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                       -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q7(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="structaiscalar__q7.html">aiscalar_q7_t</a> alpha = AISCALAR_Q7(1.0f, 0, 0);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> result_params; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q7(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q7__default_8h.html#a9904ddb34fdb99f5e448fa6a72a1aedf">aimath_q7_default_elu</a>(&amp;x, &amp;alpha, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q7__default_8h_html_a9904ddb34fdb99f5e448fa6a72a1aedf"><div class="ttname"><a href="aimath__q7__default_8h.html#a9904ddb34fdb99f5e448fa6a72a1aedf">aimath_q7_default_elu</a></div><div class="ttdeci">void aimath_q7_default_elu(const aitensor_t *x, const void *alpha, aitensor_t *result)</div><div class="ttdoc">Calculates the exponential rectifier (ELU) value of each element in a Q7  tensor.</div></div>
<div class="ttc" id="astructaiscalar__q7_html"><div class="ttname"><a href="structaiscalar__q7.html">aiscalar_q7</a></div><div class="ttdoc">Single quantized Q7  value/scalar.</div><div class="ttdef"><b>Definition:</b> aimath_q7.h:155</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*x</td><td>Q7 tensor to calculate the ELU from (N-D tensor) </td></tr>
    <tr><td class="paramname">*alpha</td><td>Scalar \( \alpha \) (type aiscalar_q7_t) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q7 tensor (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a6bf3ea9845ce25041a98628df953f23c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6bf3ea9845ce25041a98628df953f23c">&#9670;&nbsp;</a></span>aimath_q7_default_init_zeros()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q7_default_init_zeros </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>tensor</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Fills a <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor with zeros. </p>
<p class="formulaDsp">
\[ tensor_{i} = 0 \]
</p>
<p>The function sets all tensor elements, the shift and the zero_point to 0.</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t tensor_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> tensor_params;</div>
<div class="line">int8_t tensor_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> tensor = AITENSOR_2D_Q7(tensor_shape, &amp;tensor_params, tensor_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q7__default_8h.html#a6bf3ea9845ce25041a98628df953f23c">aimath_q7_default_init_zeros</a>(&amp;tensor);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;tensor);</div>
<div class="ttc" id="aaimath__q7__default_8h_html_a6bf3ea9845ce25041a98628df953f23c"><div class="ttname"><a href="aimath__q7__default_8h.html#a6bf3ea9845ce25041a98628df953f23c">aimath_q7_default_init_zeros</a></div><div class="ttdeci">void aimath_q7_default_init_zeros(aitensor_t *tensor)</div><div class="ttdoc">Fills a Q7  tensor with zeros.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*tensor</td><td>Q7 tensor to set to zero (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="abc7fe8c9d9ed1b56683871aad5b79e6b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abc7fe8c9d9ed1b56683871aad5b79e6b">&#9670;&nbsp;</a></span>aimath_q7_default_leaky_relu()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q7_default_leaky_relu </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>alpha</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the leaky rectifier (leaky ReLU) value of each element in a <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor. </p>
<p class="formulaDsp">
\[ result_{i} = \begin{cases} \alpha \cdot x_i &amp; \text{if } x_i &lt; 0 \\ x_i &amp; \text{if } x_i \geq 0 \end{cases} \]
</p>
<p><b>The quantization parameters of the result tensor are set to {shift = x.shift, zero_point = x.zero_point} by the function because the output values are in the interval (alpha * min(x), max(x)].</b></p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> x_params = {6, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                       -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q7(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="structaiscalar__q7.html">aiscalar_q7_t</a> alpha = AISCALAR_Q7(0.01f, 10, 0);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> result_params; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q7(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q7__default_8h.html#abc7fe8c9d9ed1b56683871aad5b79e6b">aimath_q7_default_leaky_relu</a>(&amp;x, &amp;alpha, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q7__default_8h_html_abc7fe8c9d9ed1b56683871aad5b79e6b"><div class="ttname"><a href="aimath__q7__default_8h.html#abc7fe8c9d9ed1b56683871aad5b79e6b">aimath_q7_default_leaky_relu</a></div><div class="ttdeci">void aimath_q7_default_leaky_relu(const aitensor_t *x, const void *alpha, aitensor_t *result)</div><div class="ttdoc">Calculates the leaky rectifier (leaky ReLU) value of each element in a Q7  tensor.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*x</td><td>Q7 tensor to calculate the leaky ReLU from (N-D tensor) </td></tr>
    <tr><td class="paramname">*alpha</td><td>Scalar \( \alpha \) (type aiscalar_q7_t) for the leakage </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q7 tensor (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ae14116c35f7bcafa336131627e208acd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae14116c35f7bcafa336131627e208acd">&#9670;&nbsp;</a></span>aimath_q7_default_linear32()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q7_default_linear32 </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs a matrix multiplication of <a class="el" href="aimath__q7_8h.html">Q7 </a> matrices a and b and adds a <a class="el" href="aimath__q31_8h.html">Q31 </a> vector c to each row. </p>
<p>The addition of the horizontal vector c is performed via broadcast, i.e. element wise in each column Mathematically this broadcast is equal to multiplying c with an vertical vector (with the same number of elements as c) and adding the result to \( a \cdot b \).</p>
<p><b>The quantization parameters of the vector c have to be {zero_point = 0, shift = a.shift + b.shift}!</b></p>
<p class="formulaDsp">
\[ result = a \cdot b + \left( \begin{array}{c} 1 \\ 1 \\ \vdots \\ 1 \\ \end{array}\right) \cdot c \]
</p>
<p>Example: </p><p class="formulaDsp">
\[ a = \left( \begin{array}{rrr} 1 &amp; 2 &amp; 3 \\ 4 &amp; 5 &amp; 6 \\ 7 &amp; 8 &amp; 9 \end{array}\right) \]
</p>
<p class="formulaDsp">
\[ b = \left( \begin{array}{rr} 1 &amp; 0 \\ 0 &amp; 1 \\ 0 &amp; 0 \end{array}\right) \]
</p>
<p class="formulaDsp">
\[ c = \left( \begin{array}{rr} 2 &amp; 5 \end{array}\right) \]
</p>
<p class="formulaDsp">
\[ result = a \cdot b + \left( \begin{array}{r} 1 \\ 1 \\ 1 \\ \end{array}\right) \cdot c \]
</p>
<p class="formulaDsp">
\[ = \left( \begin{array}{rr} 1 &amp; 2 \\ 4 &amp; 5 \\ 7 &amp; 8 \end{array}\right) + \left( \begin{array}{rr} 2 &amp; 5 \\ 2 &amp; 5 \\ 2 &amp; 5 \end{array}\right) \]
</p>
<p class="formulaDsp">
\[ = \left( \begin{array}{rr} 3 &amp; 7 \\ 6 &amp; 10 \\ 9 &amp; 13 \end{array}\right) \]
</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t a_shape[2] = {3, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> a_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t a_data[3*3] = { 2,  4,  6,</div>
<div class="line">                       8, 10, 12,</div>
<div class="line">                      14, 16, 18};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> a = AITENSOR_2D_Q7(a_shape, &amp;a_params, a_data);</div>
<div class="line"> </div>
<div class="line">uint16_t b_shape[2] = {3, 2};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> b_params = {2, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t b_data[3*2] = {4, 0,</div>
<div class="line">                      0, 4,</div>
<div class="line">                      0, 0};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> b = AITENSOR_2D_Q7(b_shape, &amp;b_params, b_data);</div>
<div class="line"> </div>
<div class="line">uint16_t c_shape[2] = {1, 2};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> c_params = {3, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t c_data[1*2] = {16, 40};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> c = AITENSOR_2D_Q31(c_shape, &amp;c_params, c_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {3, 2};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> result_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t result_data[3*2];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q7(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q7__default_8h.html#ae14116c35f7bcafa336131627e208acd">aimath_q7_default_linear32</a>(&amp;a, &amp;b, &amp;c, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q7__default_8h_html_ae14116c35f7bcafa336131627e208acd"><div class="ttname"><a href="aimath__q7__default_8h.html#ae14116c35f7bcafa336131627e208acd">aimath_q7_default_linear32</a></div><div class="ttdeci">void aimath_q7_default_linear32(const aitensor_t *a, const aitensor_t *b, const aitensor_t *c, aitensor_t *result)</div><div class="ttdoc">Performs a matrix multiplication of Q7  matrices a and b and adds a Q31  vector c to each row.</div></div>
<div class="ttc" id="astructaimath__q31__params_html"><div class="ttname"><a href="structaimath__q31__params.html">aimath_q31_params</a></div><div class="ttdoc">Parameters used for the quantized Q31  values, used as property of a tensor.</div><div class="ttdef"><b>Definition:</b> aimath_q31.h:149</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*a</td><td>Q7 matrix a (2D tensor of shape [N x K]) </td></tr>
    <tr><td class="paramname">*b</td><td>Q7 matrix b (2D tensor of shape [K x M]) </td></tr>
    <tr><td class="paramname">*c</td><td>Q31 vector c (2D tensor of shape [1 x M] or 1D tensor of shape [M]) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q7 matrix (2D tensor of shape [N x M]) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a8457eb57e8075ad70123092df8b57233"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8457eb57e8075ad70123092df8b57233">&#9670;&nbsp;</a></span>aimath_q7_default_linear32_bt()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q7_default_linear32_bt </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs a matrix multiplication of <a class="el" href="aimath__q7_8h.html">Q7 </a> matrices a and b (transposed) and adds a <a class="el" href="aimath__q31_8h.html">Q31 </a> vector c to each row. </p>
<p>Same operation as <a class="el" href="aimath__q7__default_8h.html#ae14116c35f7bcafa336131627e208acd" title="Performs a matrix multiplication of Q7  matrices a and b and adds a Q31  vector c to each row.">aimath_q7_default_linear32()</a> but with a transposed b matrix.</p>
<p>The addition of the horizontal vector c is performed via broadcast, i.e. element wise in each column Mathematically this broadcast is equal to multiplying c with an vertical vector (with the same number of elements as c) and adding the result to \( a \cdot b^T \).</p>
<p>** The quantization parameters of the vector c have to be {zero_point = 0, shift = a.shift + b.shift}! **</p>
<p class="formulaDsp">
\[ result = a \cdot b^T + \left( \begin{array}{c} 1 \\ 1 \\ \vdots \\ 1 \\ \end{array}\right) \cdot c \]
</p>
<p>Example: </p><p class="formulaDsp">
\[ a = \left( \begin{array}{rrr} 1 &amp; 2 &amp; 3 \\ 4 &amp; 5 &amp; 6 \\ 7 &amp; 8 &amp; 9 \end{array}\right) \]
</p>
<p class="formulaDsp">
\[ b = \left( \begin{array}{rr} 1 &amp; 0 &amp; 0 \\ 0 &amp; 1 &amp; 0 \end{array}\right) \]
</p>
<p class="formulaDsp">
\[ c = \left( \begin{array}{rr} 2 &amp; 5 \end{array}\right) \]
</p>
<p class="formulaDsp">
\[ result = a \cdot b^T + \left( \begin{array}{r} 1 \\ 1 \\ 1 \\ \end{array}\right) \cdot c \]
</p>
<p class="formulaDsp">
\[ = \left( \begin{array}{rr} 1 &amp; 2 \\ 4 &amp; 5 \\ 7 &amp; 8 \end{array}\right) + \left( \begin{array}{rr} 2 &amp; 5 \\ 2 &amp; 5 \\ 2 &amp; 5 \end{array}\right) \]
</p>
<p class="formulaDsp">
\[ = \left( \begin{array}{rr} 3 &amp; 7 \\ 6 &amp; 10 \\ 9 &amp; 13 \end{array}\right) \]
</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t a_shape[2] = {3, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> a_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t a_data[3*3] = { 2,  4,  6,</div>
<div class="line">                       8, 10, 12,</div>
<div class="line">                      14, 16, 18};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> a = AITENSOR_2D_Q7(a_shape, &amp;a_params, a_data);</div>
<div class="line"> </div>
<div class="line">uint16_t b_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> b_params = {2, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t b_data[2*3] = {4, 0, 0,</div>
<div class="line">                      0, 4, 0};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> b = AITENSOR_2D_Q7(b_shape, &amp;b_params, b_data);</div>
<div class="line"> </div>
<div class="line">uint16_t c_shape[2] = {1, 2};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> c_params = {3, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t c_data[1*2] = {16, 40};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> c = AITENSOR_2D_Q31(c_shape, &amp;c_params, c_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {3, 2};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> result_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t result_data[3*2];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q7(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q7__default_8h.html#a8457eb57e8075ad70123092df8b57233">aimath_q7_default_linear32_bt</a>(&amp;a, &amp;b, &amp;c, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q7__default_8h_html_a8457eb57e8075ad70123092df8b57233"><div class="ttname"><a href="aimath__q7__default_8h.html#a8457eb57e8075ad70123092df8b57233">aimath_q7_default_linear32_bt</a></div><div class="ttdeci">void aimath_q7_default_linear32_bt(const aitensor_t *a, const aitensor_t *b, const aitensor_t *c, aitensor_t *result)</div><div class="ttdoc">Performs a matrix multiplication of Q7  matrices a and b (transposed) and adds a Q31  vector c to eac...</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*a</td><td>Q7 matrix a (2D tensor of shape [N x K]) </td></tr>
    <tr><td class="paramname">*b</td><td>Q7 matrix b (2D tensor of shape [M x K]) </td></tr>
    <tr><td class="paramname">*c</td><td>Q31 vector c (2D tensor of shape [1 x M] or 1D tensor of shape [M]) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q7 matrix (2D tensor of shape [N x M]) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="abb9d7e4822da469bd0196c6c8c24039c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abb9d7e4822da469bd0196c6c8c24039c">&#9670;&nbsp;</a></span>aimath_q7_default_mat_mul()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q7_default_mat_mul </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs a matrix multiplication of <a class="el" href="aimath__q7_8h.html">Q7 </a> matrices a and b. </p>
<p class="formulaDsp">
\[ result = a \cdot b \]
</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t a_shape[2] = {3, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> a_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t a_data[3*3] = { 2,  4,  6,</div>
<div class="line">                       8, 10, 12,</div>
<div class="line">                      14, 16, 18};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> a = AITENSOR_2D_Q7(a_shape, &amp;a_params, a_data);</div>
<div class="line"> </div>
<div class="line">uint16_t b_shape[2] = {3, 2};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> b_params = {2, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t b_data[3*2] = {4, 0,</div>
<div class="line">                      0, 4,</div>
<div class="line">                      0, 0};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> b = AITENSOR_2D_Q7(b_shape, &amp;b_params, b_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {3, 2};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> result_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t result_data[3*2];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q7(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q7__default_8h.html#abb9d7e4822da469bd0196c6c8c24039c">aimath_q7_default_mat_mul</a>(&amp;a, &amp;b, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q7__default_8h_html_abb9d7e4822da469bd0196c6c8c24039c"><div class="ttname"><a href="aimath__q7__default_8h.html#abb9d7e4822da469bd0196c6c8c24039c">aimath_q7_default_mat_mul</a></div><div class="ttdeci">void aimath_q7_default_mat_mul(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)</div><div class="ttdoc">Performs a matrix multiplication of Q7  matrices a and b.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*a</td><td>Q7 matrix a (2D tensor of shape [N x K]) </td></tr>
    <tr><td class="paramname">*b</td><td>Q7 matrix b (2D tensor of shape [K x M]) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q7 matrix of the multiplication (2D tensor of shape [N x M]) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="aea8ff135f469f27eda0478fc21e4a568"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aea8ff135f469f27eda0478fc21e4a568">&#9670;&nbsp;</a></span>aimath_q7_default_multiply()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q7_default_multiply </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs an element wise multiplication of <a class="el" href="aimath__q7_8h.html">Q7 </a> tensors a and b (Hadamard product) </p>
<p class="formulaDsp">
\[ result = a \circ b \]
</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t a_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> a_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t a_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                       -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> a = AITENSOR_2D_Q7(a_shape, &amp;a_params, a_data);</div>
<div class="line"> </div>
<div class="line">uint16_t b_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> b_params = {2, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t b_data[2*3] = {  4,  -8,  12,</div>
<div class="line">                      -16,  20, -24};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> b = AITENSOR_2D_Q7(b_shape, &amp;b_params, b_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> result_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q7(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q7__default_8h.html#aea8ff135f469f27eda0478fc21e4a568">aimath_q7_default_multiply</a>(&amp;a, &amp;b, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q7__default_8h_html_aea8ff135f469f27eda0478fc21e4a568"><div class="ttname"><a href="aimath__q7__default_8h.html#aea8ff135f469f27eda0478fc21e4a568">aimath_q7_default_multiply</a></div><div class="ttdeci">void aimath_q7_default_multiply(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)</div><div class="ttdoc">Performs an element wise multiplication of Q7  tensors a and b (Hadamard product)</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*a</td><td>Q7 tensor a (N-D tensor) </td></tr>
    <tr><td class="paramname">*b</td><td>Q7 tensor b (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q7 tensor of the element wise multiplication (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a6baa6499f2ecf3ae40e9f08ba39499cf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6baa6499f2ecf3ae40e9f08ba39499cf">&#9670;&nbsp;</a></span>aimath_q7_default_relu()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q7_default_relu </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the rectifier (ReLU) value of each element in a <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor. </p>
<p class="formulaDsp">
\[ result_{i} = max(0, x_{i}) \]
</p>
<p><b>The quantization parameters of the result tensor are set to {shift = x.shift, zero_point = x.zero_point} by the function because the output values are in the interval [0, max(x)].</b></p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> x_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                       -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q7(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> result_params;</div>
<div class="line">int8_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q7(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q7__default_8h.html#a6baa6499f2ecf3ae40e9f08ba39499cf">aimath_q7_default_relu</a>(&amp;x, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q7__default_8h_html_a6baa6499f2ecf3ae40e9f08ba39499cf"><div class="ttname"><a href="aimath__q7__default_8h.html#a6baa6499f2ecf3ae40e9f08ba39499cf">aimath_q7_default_relu</a></div><div class="ttdeci">void aimath_q7_default_relu(const aitensor_t *x, aitensor_t *result)</div><div class="ttdoc">Calculates the rectifier (ReLU) value of each element in a Q7  tensor.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*x</td><td>Q7 tensor to calculate the ReLU from (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q7 tensor (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ab09f6f205301031766d1211f1f22b77d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab09f6f205301031766d1211f1f22b77d">&#9670;&nbsp;</a></span>aimath_q7_default_scalar_mul()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q7_default_scalar_mul </td>
          <td>(</td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>scalar</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs a scalar multiplication (scaling) of <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor a and a scalar. </p>
<p class="formulaDsp">
\[ result = scalar \cdot a \]
</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t a_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> a_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t a_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                       -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> a = AITENSOR_2D_Q7(a_shape, &amp;a_params, a_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="structaiscalar__q7.html">aiscalar_q7_t</a> scalar = AISCALAR_Q7(0.1f, 7, 0); <span class="comment">// (value, shift, zero_point)</span></div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> result_params = {7, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q7(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q7__default_8h.html#ab09f6f205301031766d1211f1f22b77d">aimath_q7_default_scalar_mul</a>(&amp;scalar, &amp;a, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q7__default_8h_html_ab09f6f205301031766d1211f1f22b77d"><div class="ttname"><a href="aimath__q7__default_8h.html#ab09f6f205301031766d1211f1f22b77d">aimath_q7_default_scalar_mul</a></div><div class="ttdeci">void aimath_q7_default_scalar_mul(const void *scalar, const aitensor_t *a, aitensor_t *result)</div><div class="ttdoc">Performs a scalar multiplication (scaling) of Q7  tensor a and a scalar.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*scalar</td><td>Scalar (type aiscalar_q7_t) </td></tr>
    <tr><td class="paramname">*a</td><td>Q7 tensor a (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q7 tensor of the scalar multiplication (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a276405dee87319f05cff812b225ec5ed"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a276405dee87319f05cff812b225ec5ed">&#9670;&nbsp;</a></span>aimath_q7_default_sigmoid()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q7_default_sigmoid </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the sigmoid of each element in a <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor. </p>
<p class="formulaDsp">
\[ result_{i} = \sigma(x_{i}) = \frac{1}{1 + e^{-x_{i}}} \]
</p>
<p>The sigmoid is calculated with a piecewise linear approximation (PLAN) to avoid using exponential functions.</p>
<p class="formulaDsp">
\[ result_{i} = \sigma_{PLAN}(x_i) = \begin{cases} 1 &amp; \text{if } 5 \leq x_i\\ 0.03125 \cdot |x_i| + 0.84375 &amp; \text{if } 2.375 \leq x_i &lt; 5\\ 0.0125 \cdot |x_i| + 0.625 &amp; \text{if } 1 \leq x_i &lt; 2.375\\ 0.25 \cdot |x_i| + 0.5 &amp; \text{if } 0 \leq x_i &lt; 1\\ 1 - \sigma_{PLAN}(- x_i) &amp; \text{if } x_i &lt; 0\\ \end{cases} \]
</p>
<p><b>The quantization parameters of the result tensor are set to {shift = 8, zero_point = -2^7} by the function because the output values are in the interval (0, 1).</b></p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> x_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                       -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q7(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> result_params;</div>
<div class="line">int8_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q7(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q7__default_8h.html#a276405dee87319f05cff812b225ec5ed">aimath_q7_default_sigmoid</a>(&amp;x, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q7__default_8h_html_a276405dee87319f05cff812b225ec5ed"><div class="ttname"><a href="aimath__q7__default_8h.html#a276405dee87319f05cff812b225ec5ed">aimath_q7_default_sigmoid</a></div><div class="ttdeci">void aimath_q7_default_sigmoid(const aitensor_t *x, aitensor_t *result)</div><div class="ttdoc">Calculates the sigmoid of each element in a Q7  tensor.</div></div>
</div><!-- fragment --><dl class="section see"><dt>See also</dt><dd>Sigmoid PLAN: <a href="https://www.researchgate.net/figure/Comparative-representation-of-the-sigmoid-function-and-PLAN-approximation_fig7_228618304">https://www.researchgate.net/figure/Comparative-representation-of-the-sigmoid-function-and-PLAN-approximation_fig7_228618304</a></dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*x</td><td>Q7 tensor to calculate the sigmoid from (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q7 tensor (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a9a397ffb85d001e9d99c904369e8c7f4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9a397ffb85d001e9d99c904369e8c7f4">&#9670;&nbsp;</a></span>aimath_q7_default_softmax()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q7_default_softmax </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the softmax value of each batch element (row) of a <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor. </p>
<p class="formulaDsp">
\[ result_{i} = \frac{e^{x_i}}{\sum_{j=1}^{K} e^{x_j}} \]
</p>
<p><b>The quantization parameters of the result tensor are set to {shift = 8, zero_point = -128} by the function because the output values are in the interval (0, 1).</b></p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> x_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                       -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q7(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> result_params;</div>
<div class="line">int8_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q7(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q7__default_8h.html#a9a397ffb85d001e9d99c904369e8c7f4">aimath_q7_default_softmax</a>(&amp;x, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q7__default_8h_html_a9a397ffb85d001e9d99c904369e8c7f4"><div class="ttname"><a href="aimath__q7__default_8h.html#a9a397ffb85d001e9d99c904369e8c7f4">aimath_q7_default_softmax</a></div><div class="ttdeci">void aimath_q7_default_softmax(const aitensor_t *x, aitensor_t *result)</div><div class="ttdoc">Calculates the softmax value of each batch element (row) of a Q7  tensor.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*x</td><td>Q7 tensor to calculate the softmax from (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q7 tensor (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ade55b697f7366df6aa1350cca23411f8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ade55b697f7366df6aa1350cca23411f8">&#9670;&nbsp;</a></span>aimath_q7_default_softsign()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q7_default_softsign </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the softsign value of each element in a <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor. </p>
<p class="formulaDsp">
\[ result_{i} = \frac {x_i} {1 + |x_i|} \]
</p>
<p><b>The quantization parameters of the result tensor are set to {shift = 7, zero_point = 0} by the function because the output values are in the interval (-1, 1).</b></p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> x_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                       -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q7(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> result_params;</div>
<div class="line">int8_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q7(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q7__default_8h.html#ade55b697f7366df6aa1350cca23411f8">aimath_q7_default_softsign</a>(&amp;x, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q7__default_8h_html_ade55b697f7366df6aa1350cca23411f8"><div class="ttname"><a href="aimath__q7__default_8h.html#ade55b697f7366df6aa1350cca23411f8">aimath_q7_default_softsign</a></div><div class="ttdeci">void aimath_q7_default_softsign(const aitensor_t *x, aitensor_t *result)</div><div class="ttdoc">Calculates the softsign value of each element in a Q7  tensor.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*x</td><td>Q7 tensor to calculate the softsign from (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q7 tensor (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ad54410eb70a8dc52402cce9df193efc8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad54410eb70a8dc52402cce9df193efc8">&#9670;&nbsp;</a></span>aimath_q7_default_tanh()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q7_default_tanh </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the tanh of each element in a <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor. </p>
<p class="formulaDsp">
\[ result_{i} = \tanh(x_{i}) = \frac{e^{x_i} - e^{-x_i}}{e^{x_i} + e^{-x_i}} \]
</p>
<p>The tanh is calculated with a piecewise linear approximation (PLA) to avoid using exponential functions.</p>
<p class="formulaDsp">
\[ result_{i} = \tanh_{PLA}(x_i) = 2 \cdot \sigma(2x_i) - 1 = \begin{cases} 1 &amp; \text{if } 5 \leq x_i\\ 0.0625 \cdot |x_i| + 0.6875 &amp; \text{if } 2.375 \leq x_i &lt; 5\\ 0.25 \cdot |x_i| + 0.25 &amp; \text{if } 1 \leq x_i &lt; 2.375\\ 0.5 \cdot |x_i| &amp; \text{if } 0 \leq x_i &lt; 1\\ - \tanh_{PLA}(- x_i) &amp; \text{if } x_i &lt; 0\\ \end{cases} \]
</p>
<p><b>The quantization parameters of the result tensor are set to {shift = 7, zero_point = 0} by the function because the output values are in the interval (-1, 1).</b></p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> x_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                       -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q7(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> result_params;</div>
<div class="line">int8_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q7(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q7__default_8h.html#ad54410eb70a8dc52402cce9df193efc8">aimath_q7_default_tanh</a>(&amp;x, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q7__default_8h_html_ad54410eb70a8dc52402cce9df193efc8"><div class="ttname"><a href="aimath__q7__default_8h.html#ad54410eb70a8dc52402cce9df193efc8">aimath_q7_default_tanh</a></div><div class="ttdeci">void aimath_q7_default_tanh(const aitensor_t *x, aitensor_t *result)</div><div class="ttdoc">Calculates the tanh of each element in a Q7  tensor.</div></div>
</div><!-- fragment --><dl class="section see"><dt>See also</dt><dd>Sigmoid PLAN: <a href="https://www.researchgate.net/figure/Comparative-representation-of-the-sigmoid-function-and-PLAN-approximation_fig7_228618304">https://www.researchgate.net/figure/Comparative-representation-of-the-sigmoid-function-and-PLAN-approximation_fig7_228618304</a></dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*x</td><td>Q7 tensor to calculate the tanh from (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q7 tensor (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a5495242497ca55e067957e5cfb8ecd47"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5495242497ca55e067957e5cfb8ecd47">&#9670;&nbsp;</a></span>aimath_q7_default_tensor_add_different_shift()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q7_default_tensor_add_different_shift </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs an element wise addition of <a class="el" href="aimath__q7_8h.html">Q7 </a> tensors a and b with different shifts. </p>
<p class="formulaDsp">
\[ result = a + b \]
</p>
<p>The tensors a, b and result can have different shifts. The function will rescale the tensors internally to perform the addition. If a, b and result have the same shift, use <a class="el" href="aimath__q7__default_8h.html#a3030c62db3aba6f211019155866ac188" title="Performs an element wise addition of Q7  tensors a and b with same shifts.">aimath_q7_default_tensor_add_same_shift()</a> instead because it is more efficient.</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t a_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> a_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t a_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                       -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> a = AITENSOR_2D_Q7(a_shape, &amp;a_params, a_data);</div>
<div class="line"> </div>
<div class="line">uint16_t b_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> b_params = {2, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t b_data[2*3] = {  4,  -8,   12,</div>
<div class="line">                       -16,  20, -24};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> b = AITENSOR_2D_Q7(b_shape, &amp;b_params, b_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> result_params = {0, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q7(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q7__default_8h.html#a5495242497ca55e067957e5cfb8ecd47">aimath_q7_default_tensor_add_different_shift</a>(&amp;a, &amp;b, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q7__default_8h_html_a5495242497ca55e067957e5cfb8ecd47"><div class="ttname"><a href="aimath__q7__default_8h.html#a5495242497ca55e067957e5cfb8ecd47">aimath_q7_default_tensor_add_different_shift</a></div><div class="ttdeci">void aimath_q7_default_tensor_add_different_shift(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)</div><div class="ttdoc">Performs an element wise addition of Q7  tensors a and b with different shifts.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*a</td><td>Q7 tensor a (N-D tensor) </td></tr>
    <tr><td class="paramname">*b</td><td>Q7 tensor b (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q7 tensor of the element wise addition (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a3030c62db3aba6f211019155866ac188"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3030c62db3aba6f211019155866ac188">&#9670;&nbsp;</a></span>aimath_q7_default_tensor_add_same_shift()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q7_default_tensor_add_same_shift </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs an element wise addition of <a class="el" href="aimath__q7_8h.html">Q7 </a> tensors a and b with same shifts. </p>
<p class="formulaDsp">
\[ result = a + b \]
</p>
<p>The tensors a, b and result must have the same shift. If a, b and result have the different shifts, use <a class="el" href="aimath__q7__default_8h.html#a5495242497ca55e067957e5cfb8ecd47" title="Performs an element wise addition of Q7  tensors a and b with different shifts.">aimath_q7_default_tensor_add_different_shift()</a> instead.</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t a_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> a_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t a_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                       -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> a = AITENSOR_2D_Q7(a_shape, &amp;a_params, a_data);</div>
<div class="line"> </div>
<div class="line">uint16_t b_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> b_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t b_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                       -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> b = AITENSOR_2D_Q7(b_shape, &amp;b_params, b_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> result_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q7(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q7__default_8h.html#a3030c62db3aba6f211019155866ac188">aimath_q7_default_tensor_add_same_shift</a>(&amp;a, &amp;b, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q7__default_8h_html_a3030c62db3aba6f211019155866ac188"><div class="ttname"><a href="aimath__q7__default_8h.html#a3030c62db3aba6f211019155866ac188">aimath_q7_default_tensor_add_same_shift</a></div><div class="ttdeci">void aimath_q7_default_tensor_add_same_shift(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)</div><div class="ttdoc">Performs an element wise addition of Q7  tensors a and b with same shifts.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*a</td><td>Q7 tensor a (N-D tensor) </td></tr>
    <tr><td class="paramname">*b</td><td>Q7 tensor b (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q7 tensor of the element wise addition (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a95cefff68f55a80365250be42c54079c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a95cefff68f55a80365250be42c54079c">&#9670;&nbsp;</a></span>aimath_q7_default_tensor_sub_different_shift()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q7_default_tensor_sub_different_shift </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs an element wise addition of <a class="el" href="aimath__q7_8h.html">Q7 </a> tensors a and b with different shifts. </p>
<p class="formulaDsp">
\[ result = a - b \]
</p>
<p>The tensors a, b and result can have different shifts. The function will rescale the tensors internally to perform the subtraction. If a, b and result have the same shift, use <a class="el" href="aimath__q7__default_8h.html#ab7cd6d81cc93235513fc28b27dc2fbd8" title="Performs an element wise subtraction of Q7  tensors a and b with same shifts.">aimath_q7_default_tensor_sub_same_shift()</a> instead because it is more efficient.</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t a_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> a_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t a_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                       -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> a = AITENSOR_2D_Q7(a_shape, &amp;a_params, a_data);</div>
<div class="line"> </div>
<div class="line">uint16_t b_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> b_params = {2, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t b_data[2*3] = {  4,  8, 12,</div>
<div class="line">                       16, 20, 24};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> b = AITENSOR_2D_Q7(b_shape, &amp;b_params, b_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> result_params = {0, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q7(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q7__default_8h.html#a95cefff68f55a80365250be42c54079c">aimath_q7_default_tensor_sub_different_shift</a>(&amp;a, &amp;b, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q7__default_8h_html_a95cefff68f55a80365250be42c54079c"><div class="ttname"><a href="aimath__q7__default_8h.html#a95cefff68f55a80365250be42c54079c">aimath_q7_default_tensor_sub_different_shift</a></div><div class="ttdeci">void aimath_q7_default_tensor_sub_different_shift(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)</div><div class="ttdoc">Performs an element wise addition of Q7  tensors a and b with different shifts.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*a</td><td>Q7 tensor a (N-D tensor) </td></tr>
    <tr><td class="paramname">*b</td><td>Q7 tensor b (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q7 tensor of the element wise subtraction (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ab7cd6d81cc93235513fc28b27dc2fbd8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab7cd6d81cc93235513fc28b27dc2fbd8">&#9670;&nbsp;</a></span>aimath_q7_default_tensor_sub_same_shift()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q7_default_tensor_sub_same_shift </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs an element wise subtraction of <a class="el" href="aimath__q7_8h.html">Q7 </a> tensors a and b with same shifts. </p>
<p class="formulaDsp">
\[ result = a - b \]
</p>
<p>The tensors a, b and result must have the same shift. If a, b and result have the different shifts, use <a class="el" href="aimath__q7__default_8h.html#a95cefff68f55a80365250be42c54079c" title="Performs an element wise addition of Q7  tensors a and b with different shifts.">aimath_q7_default_tensor_sub_different_shift()</a> instead.</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t a_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> a_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t a_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                       -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> a = AITENSOR_2D_Q7(a_shape, &amp;a_params, a_data);</div>
<div class="line"> </div>
<div class="line">uint16_t b_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> b_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t b_data[2*3] = { 2,  4,  6,</div>
<div class="line">                       8, 10, 12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> b = AITENSOR_2D_Q7(b_shape, &amp;b_params, b_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> result_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q7(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q7__default_8h.html#ab7cd6d81cc93235513fc28b27dc2fbd8">aimath_q7_default_tensor_sub_same_shift</a>(&amp;a, &amp;b, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q7__default_8h_html_ab7cd6d81cc93235513fc28b27dc2fbd8"><div class="ttname"><a href="aimath__q7__default_8h.html#ab7cd6d81cc93235513fc28b27dc2fbd8">aimath_q7_default_tensor_sub_same_shift</a></div><div class="ttdeci">void aimath_q7_default_tensor_sub_same_shift(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)</div><div class="ttdoc">Performs an element wise subtraction of Q7  tensors a and b with same shifts.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*a</td><td>Q7 tensor a (N-D tensor) </td></tr>
    <tr><td class="paramname">*b</td><td>Q7 tensor b (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q7 tensor of the element wise subtraction (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a1f38ebd2e786763092b3d9fa97088388"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1f38ebd2e786763092b3d9fa97088388">&#9670;&nbsp;</a></span>aimath_q7_default_transpose_matrix()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q7_default_transpose_matrix </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Transpose a <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor. </p>
<p class="formulaDsp">
\[ x \leftarrow x^T \]
</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> x_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                       -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q7(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q7__default_8h.html#a1f38ebd2e786763092b3d9fa97088388">aimath_q7_default_transpose_matrix</a>(&amp;x);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;x);</div>
<div class="ttc" id="aaimath__q7__default_8h_html_a1f38ebd2e786763092b3d9fa97088388"><div class="ttname"><a href="aimath__q7__default_8h.html#a1f38ebd2e786763092b3d9fa97088388">aimath_q7_default_transpose_matrix</a></div><div class="ttdeci">void aimath_q7_default_transpose_matrix(aitensor_t *x)</div><div class="ttdoc">Transpose a Q7  tensor.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*x</td><td>Q7 tensor to be transposed (2D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ae989b3b4870f77f485ac8c1fc1657703"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae989b3b4870f77f485ac8c1fc1657703">&#9670;&nbsp;</a></span>aimath_q7_default_transpose_vector()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q7_default_transpose_vector </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>vector</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Transposes a <a class="el" href="aimath__q7_8h.html">Q7 </a> vector. </p>
<p>The given tensor must be a vector (2D tensor of shape [1 x N] or [N x 1]).</p>
<p class="formulaDsp">
\[ vector \leftarrow vector^T \]
</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t vector_shape[2] = {1, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> vector_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t vector_data[2*3] = {  2,  -4,   6};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> vector = AITENSOR_2D_Q7(vector_shape, &amp;vector_params, vector_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q7__default_8h.html#ae989b3b4870f77f485ac8c1fc1657703">aimath_q7_default_transpose_vector</a>(&amp;vector);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;vector);</div>
<div class="ttc" id="aaimath__q7__default_8h_html_ae989b3b4870f77f485ac8c1fc1657703"><div class="ttname"><a href="aimath__q7__default_8h.html#ae989b3b4870f77f485ac8c1fc1657703">aimath_q7_default_transpose_vector</a></div><div class="ttdeci">void aimath_q7_default_transpose_vector(aitensor_t *vector)</div><div class="ttdoc">Transposes a Q7  vector.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*vector</td><td>Q7 vector (2D tensor of shape [1 x N] or [N x 1]) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a2264128c09cf1d1e7c0a6699fe75b2c8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2264128c09cf1d1e7c0a6699fe75b2c8">&#9670;&nbsp;</a></span>aimath_q7_default_zero_tensor()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q7_default_zero_tensor </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>tensor</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Fills a <a class="el" href="aimath__q7_8h.html">Q7 </a> tensor with zeros. </p>
<p class="formulaDsp">
\[ tensor_{i} = 0 \]
</p>
<p>The function sets all tensor elements to the zero_point given in the tensor parameters.</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t tensor_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q7__params.html">aimath_q7_params_t</a> tensor_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int8_t tensor_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                            -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> tensor = AITENSOR_2D_Q7(tensor_shape, &amp;tensor_params, tensor_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q7__default_8h.html#a2264128c09cf1d1e7c0a6699fe75b2c8">aimath_q7_default_zero_tensor</a>(&amp;tensor);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;tensor);</div>
<div class="ttc" id="aaimath__q7__default_8h_html_a2264128c09cf1d1e7c0a6699fe75b2c8"><div class="ttname"><a href="aimath__q7__default_8h.html#a2264128c09cf1d1e7c0a6699fe75b2c8">aimath_q7_default_zero_tensor</a></div><div class="ttdeci">void aimath_q7_default_zero_tensor(aitensor_t *tensor)</div><div class="ttdoc">Fills a Q7  tensor with zeros.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*tensor</td><td>Q7 tensor to set to zero (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_1e5d3661ed79af157d57e64a38265d09.html">basic</a></li><li class="navelem"><a class="el" href="dir_6f3c54947e40ccd50db54894d07fbfc0.html">default</a></li><li class="navelem"><a class="el" href="dir_973bc2385ef3e651973e652a47ef087c.html">aimath</a></li><li class="navelem"><a class="el" href="aimath__q7__default_8h.html">aimath_q7_default.h</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
